index.js ➔ ???   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 1
Metric Value
cc 1
c 1
b 1
f 1
nc 1
nop 1
dl 0
loc 1
ccs 0
cts 1
cp 0
crap 2
rs 10
1
import App from "app";
2
3
// application's services
4
import Request from "./ajax/Request";
5 4
import PersistentCache from "./cache/Persistent";
6
7
// example:
8
// constructor
9
// App.ServicesContainer.define("Service", require("./Service"))
10
11
// instance
12
// App.ServicesContainer.setInstance("Service", new Service());
13
14
15
// Default services
16
// interface to handle AJAX requests
17
App.ServicesContainer.define("AJAX", Request);
18
App.ServicesContainer.define("Cache", PersistentCache);
19
20
// configure AJAX to always ask for json
21
// You can ask for a new instance do get rid of this behaviour :)
22
App.ServicesContainer.get("AJAX").onStart(req => req.set("Accept", "application/json"));
23